package com.yanqu.road.entity.activity.zhenhuan.secondProcess;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_u_zhenhuan_finish_party", desc = "甄嬛传第二阶段结算茶话会数据")
public class GameZhenHuanFinishPartyData extends DataObject {
    @FieldTypeAnnotation(select = true, update = true, desc = "活动id")
    private int activityId;
    @FieldTypeAnnotation(select = true, update = true, desc = "茶话会id")
    private long partyId;
    @FieldTypeAnnotation(desc = "宴会等级,开启时等级")
    private int partyLevel;
    @FieldTypeAnnotation(desc = "宴会完成时间")
    private long finishTime;
    @FieldTypeAnnotation(desc = "宴会主人id")
    private long openUserId;
    @FieldTypeAnnotation(desc = "宴会主人服务器id")
    private long openServerId;
    @FieldTypeAnnotation(desc = "主人名字")
    private String userName;
    @FieldTypeAnnotation(desc = "主人装饰")
    private String userDecoration;
    @FieldTypeAnnotation(desc = "入座玩家简略信息")
    private List<ZhenHuanPartyUserSimpleInfo> joinUserList = new ArrayList<>();

    public GameZhenHuanFinishPartyData() {
    }

    public GameZhenHuanFinishPartyData(int activityId, long partyId) {
        this.activityId = activityId;
        this.partyId = partyId;
        setInsertOption();
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public long getPartyId() {
        return partyId;
    }

    public void setPartyId(long partyId) {
        this.partyId = partyId;
    }

    public int getPartyLevel() {
        return partyLevel;
    }

    public void setPartyLevel(int partyLevel) {
        this.partyLevel = partyLevel;
        setUpdateOption();
    }

    public long getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(long finishTime) {
        this.finishTime = finishTime;
        setUpdateOption();
    }

    public long getOpenServerId() {
        return openServerId;
    }

    public void setOpenServerId(long openServerId) {
        this.openServerId = openServerId;
        setUpdateOption();
    }

    public long getOpenUserId() {
        return openUserId;
    }

    public void setOpenUserId(long openUserId) {
        this.openUserId = openUserId;
        setUpdateOption();
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
        setUpdateOption();
    }

    public String getUserDecoration() {
        return userDecoration;
    }

    public void setUserDecoration(String userDecoration) {
        this.userDecoration = userDecoration;
        setUpdateOption();
    }

    public List<ZhenHuanPartyUserSimpleInfo> getJoinUserList() {
        return joinUserList;
    }

    public void setJoinUserList(List<ZhenHuanPartyUserSimpleInfo> joinUserList) {
        this.joinUserList = joinUserList;
        setUpdateOption();
    }

    public int getShowPartyLevel() {
        for (ZhenHuanPartyUserSimpleInfo userSimpleInfo : joinUserList) {
            if (userSimpleInfo.getPos() == 1){
                return userSimpleInfo.getLevel();
            }
        }
        return partyLevel;
    }
}
